package com.nts.visionworks.business.contents.domain;

// Generated 2013. 6. 23 ���� 6:33:40 by Hibernate Tools 4.0.0

import java.util.HashSet;
import java.util.Set;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Range;

import com.nts.visionworks.core.validation.EntityIdNotNull;

/**
 * ContentsTemplateAttribute generated by hbm2java
 */
@Entity
@Table(name = "contents_template_attribute", catalog = "visionworks")
public class ContentsTemplateAttribute implements java.io.Serializable
{

	private ContentsTemplateAttributeId id;
	private ContentsTemplate contentsTemplate;
	private String attributeKey;
	private String attributeName;
	private boolean essentialityYn;
	private short inputType;
	private String additionalComposition;
	private String defaultValue;
	private String description;
	private Set<ContentsAttribute> contentsAttributes = new HashSet<ContentsAttribute>(
			0);

	public ContentsTemplateAttribute()
	{
	}

	public ContentsTemplateAttribute(ContentsTemplateAttributeId id,
			ContentsTemplate contentsTemplate, String attributeKey,
			String attributeName, boolean essentialityYn, short inputType)
	{
		this.id = id;
		this.contentsTemplate = contentsTemplate;
		this.attributeKey = attributeKey;
		this.attributeName = attributeName;
		this.essentialityYn = essentialityYn;
		this.inputType = inputType;
	}

	public ContentsTemplateAttribute(ContentsTemplateAttributeId id,
			ContentsTemplate contentsTemplate, String attributeKey,
			String attributeName, boolean essentialityYn, short inputType,
			String additionalComposition, String defaultValue,
			String description, Set<ContentsAttribute> contentsAttributes)
	{
		this.id = id;
		this.contentsTemplate = contentsTemplate;
		this.attributeKey = attributeKey;
		this.attributeName = attributeName;
		this.essentialityYn = essentialityYn;
		this.inputType = inputType;
		this.additionalComposition = additionalComposition;
		this.defaultValue = defaultValue;
		this.description = description;
		this.contentsAttributes = contentsAttributes;
	}

	@EmbeddedId
	@AttributeOverrides(
	{
			@AttributeOverride(name = "templateAttributeId", column = @Column(name = "TemplateAttributeId", nullable = false)),
			@AttributeOverride(name = "templateId", column = @Column(name = "TemplateId", nullable = false)) })
	public ContentsTemplateAttributeId getId()
	{
		return this.id;
	}

	public void setId(ContentsTemplateAttributeId id)
	{
		this.id = id;
	}

	@EntityIdNotNull(message = "validation.contents.templateAttribute.contentsTemplateId.notNull")
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "TemplateId", nullable = false, insertable = false, updatable = false)
	public ContentsTemplate getContentsTemplate()
	{
		return this.contentsTemplate;
	}

	public void setContentsTemplate(ContentsTemplate contentsTemplate)
	{
		this.contentsTemplate = contentsTemplate;
	}

	@NotNull(message = "validation.contents.templateAttribute.attributeKey.notNull")
	@Range(message = "validation.contents.templateAttribute.attributeKey.length", max = 150, min = 1)
	@Column(name = "AttributeKey", nullable = false, length = 150)
	public String getAttributeKey()
	{
		return this.attributeKey;
	}

	public void setAttributeKey(String attributeKey)
	{
		this.attributeKey = attributeKey;
	}

	@NotNull(message = "validation.contents.templateAttribute.attributeName.notNull")
	@Range(message = "validation.contents.templateAttribute.attributeName.length", max = 300, min = 1)
	@Column(name = "AttributeName", nullable = false, length = 300)
	public String getAttributeName()
	{
		return this.attributeName;
	}

	public void setAttributeName(String attributeName)
	{
		this.attributeName = attributeName;
	}

	@Column(name = "EssentialityYn", nullable = false)
	public boolean isEssentialityYn()
	{
		return this.essentialityYn;
	}

	public void setEssentialityYn(boolean essentialityYn)
	{
		this.essentialityYn = essentialityYn;
	}

	@Range(message = "validation.contents.templateAttribute.inputtype.range", max = 3, min = 0)
	@Column(name = "InputType", nullable = false)
	public short getInputType()
	{
		return this.inputType;
	}

	public void setInputType(short inputType)
	{
		this.inputType = inputType;
	}

	@Max(message = "validation.contents.templateAttribute.additionalComposition.length", value = 200)
	@Column(name = "AdditionalComposition", length = 200)
	public String getAdditionalComposition()
	{
		return this.additionalComposition;
	}

	public void setAdditionalComposition(String additionalComposition)
	{
		this.additionalComposition = additionalComposition;
	}

	@Max(message = "validation.contents.templateAttribute.defaultValue.length", value = 40)
	@Column(name = "DefaultValue", length = 40)
	public String getDefaultValue()
	{
		return this.defaultValue;
	}

	public void setDefaultValue(String defaultValue)
	{
		this.defaultValue = defaultValue;
	}

	@Max(message = "validation.contents.templateAttribute.description.length", value = 1000)
	@Column(name = "Description", length = 1000)
	public String getDescription()
	{
		return this.description;
	}

	public void setDescription(String description)
	{
		this.description = description;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "contentsTemplateAttribute")
	public Set<ContentsAttribute> getContentsAttributes()
	{
		return this.contentsAttributes;
	}

	public void setContentsAttributes(Set<ContentsAttribute> contentsAttributes)
	{
		this.contentsAttributes = contentsAttributes;
	}

}
